home *** CD-ROM | disk | FTP | other *** search
- /* CUJ example, Stephen D. Williams, SDW Systems */
-
- #include <stdio.h>
-
- main()
- {
- char *ptr = "hi there george";
-
- puts(ptr);
-
- /* ((long *)&ptr)++; <---incorrect */
-
- (*((long**)&ptr))++;
- puts(ptr);
-
- #define ptr_type(type, prt) (*((type**)&ptr))
- puts((char *)++(ptr_type(long,ptr)));
- #undef ptr_type /* scoped macro*/
- }
-
- /*
-
- output:
-
- hi there george
- here george
- george
-
- */
-
-
-